struct ListNode* reverseBetween(struct ListNode* head, int left, int right){
    if (head == NULL || head->next == NULL || left == NULL)
        {
            return head;
        }

        struct ListNode *dummyNode = malloc(sizeof(struct ListNode));
        dummyNode->val = -1;
        dummyNode->next = head;

        struct ListNode *pre = dummyNode;
        for (int i = 1; i < left; i++)
        {
            pre = pre->next;
        }   //Pre节点指向left的前一个节点

        struct ListNode *cur = pre->next;
        struct ListNode *nextNode;
        for (int i = left; i < right; i++)
        {
            nextNode = cur->next;
            cur->next = nextNode->next;
            nextNode->next = pre->next;
            pre->next = nextNode;
        }
        return dummyNode->next;

}